package com.dragon.aipictures.domain.Enum;

import cn.hutool.core.util.ObjectUtil;

public enum UserRoleEnum {
    ADMIN("admin","管理员"),
    User("user","普通用户")

    ;

    private String value;
    private String txt;

    UserRoleEnum(String value, String txt) {
        this.value = value;
        this.txt = txt;
    }
    public static UserRoleEnum getEnumByValue(String value){
        if(ObjectUtil.isEmpty(value)){
            return null;
        }

        for (UserRoleEnum userRoleEnum : UserRoleEnum.values()) {
            if(userRoleEnum.value.equals(value)){
                return userRoleEnum;
            }
        }
        return null;
    }

    public String getValue() {
        return value;
    }

    public String getTxt() {
        return txt;
    }
}
